<template>
   
        <div>
                <el-form ref="queryForm" :model="queryForm" class="formEmbedTable mt20" :rules="rules">
                    <table>
                        <caption>Modify</caption>
                        <tr>
                            <td>TBS A/C No</td>
                            <td>
                                <el-form-item  prop="accNo">
                                    <el-input v-model="queryForm.accNo" :disabled="true"></el-input>
                                </el-form-item>              
                            </td>
                        </tr>	
                        <tr>
                            <td>Authorized Person</td>
                            <td>
                                <el-form-item  prop="authPerson">
                                    <el-input v-model="queryForm.authPerson"></el-input>
                                </el-form-item>             
                            </td>
                        </tr>
                    </table>
                </el-form>
                <div class="btnArea mt20 tac">
                    <el-button type="primary" @click="changeContact">Confime</el-button>
                    <el-button type="primary" @click="back()">Back</el-button>
                </div>

                <!--成功-->
                <el-dialog :visible.sync="changeContactDialogVisible" size=tiny class="tac" :close-on-click-modal="false" :close-on-press-escape="false">
                    <div class="tableForm mt20">
                        <div class="transactionStatus">
                            <ynet-icon Type="transactionStatus" NO="1"></ynet-icon>
                            <span class="ml15">Modify operation successful</span>
                        </div>
                        <div class="btnArea mt20 tac">
                            <el-button type="primary" @click="changeContactDialogVisible = false,addConfimEnter()">Confirm</el-button>
                        </div>
                    </div> 
                </el-dialog>
                <!--成功-->

        </div>

</template>

<script>
	export default {
		name:'systemAdd',
        props: {
            toPrimaryAcc: {type: String, default:''},
            toContacts: {type: String, default:''},
        },
		components:{
		},
        
		data(){
            return { 
               rules:{
                    authPerson: [
                        {required:true,message:'Can not be enpty',trigger:'blur'}
                    ],
               } ,
               queryForm:{
                    accNo:'',
                    authPerson:'',
                },
                changeContactDialogVisible:false,
                
            }   
        },
        mounted(){
            let _this = this
            console.log("_this.toPrimaryAcc",_this.toPrimaryAcc)
            console.log("_this.toContacts",_this.toContacts)
            _this.queryForm.accNo = _this.toPrimaryAcc
            _this.queryForm.authPerson = _this.toContacts
            
        },
		methods:{ 
            back(){
                this.$emit('back')
            },
           
            //修改密码函接收人
            changeContact(){ 
                let _this = this
                let queryData = {}
                queryData.queryAcc = _this.queryForm.accNo
                queryData.authPerson = _this.queryForm.authPerson
                _this.$refs.queryForm.validate((valid)  => {
                  if(valid){
                        _this.$tools.request(_this,"IM080212Action.do",queryData).then(data=>{
                        if(data.body.errorCode == '0'){
                                _this.changeContactDialogVisible = true
                        }else{
                            this.$alert("System Error Try again", "warning",{
                                confirmButtonText: 'Confirm',
                                callback: action => {
                                }
                            })
                        }
                    })
                  }
                })
            },
            addConfimEnter(){
               this.$emit('back')
            },
            
           
		}
	}
</script>